package com.xuzm.netty.operator;

import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ServerHandlerExceptionOperator extends ServerHandlerOperator{

    @Override
    public void exec(ChannelHandlerContext ctx, Object obj) {
        Throwable cause = (Throwable) obj;
        log.info("------客服端： {} =>断开异常 {}-----", getClientAddr(ctx), cause.getMessage());
        // 处理异常
        cause.printStackTrace();
        ctx.close();
    }
}
